CNC Example 06: Using Path3D with SoftMotion CNC
See the CNC06_File_3DPath.project sample project in the installation directory of CODESYS under ..\CODESYS SoftMotion\Examples.
This example extends the previous example CNC05_File. It demonstrates a possible application of the Path3D visualization element with CODESYS SoftMotion CNC.
Extending the program CNC_File to CNC_File_Path3D
Open the Library Manager and add the
SM3_CNC_Visulibrary.Create an instance of
SMC_PathCopierFileinCNC_PreparePathand call it at the beginning of the path processing (iState=0).Programming:

In the Visualization visualization, replace the previously used graphical display of the position with the Path3D element.
Change the properties of the Path3D element:
:
CNC_prepare_path.pcf.vs3dtInsert the Frame visualization element.
Reference the ControlPanel visualization from the
VisuElem3DPathlibrary. This element is used for controlling the camera position of the element.In the declaration of the
CNC_PreparePathprogram, create an instance ofVisuStruct3DControl(VisuElem3DPathlibrary):vc: VisuStruct3DControl;.This instance forms the data interface between the Path3D element and the camera control panel.
Change the properties of the Path3D element:
:
CNC_PreparePath.vcChange the properties of the ControlPanel element:
:
CNC_PreparePath.vcCompile, download, and start the application.
The Path3D element shows the path. You can control the camera position from the panel.
Add an instance of the
SMC_PositionTrackerfunction block in theCNCprogram. Create a memory for tracing the current track (the last traveled positions).pt: SMC_PositionTracker;pointbuffer_pt: ARRAY [0..1000] OF VisuStruct3DPathPoint;Insert a call of the instance:
SMC_PositionTrackerinto theInterpolationactionCFC:

Link the path data to the Path3D element. Change the properties of the Path3D element:
:
CNC.pt.vs3dtGo online and start the application.
The Path3D element displays the last interpolated path also to the path.
Configure other properties of Path3D. For example, configure the processed path elements to be displayed in gray:
:
Gray
